<%@ page import="java.util.List" %>
<%@ page import="java.util.ArrayList" %><%--
  Created by IntelliJ IDEA.
  User: 86131
  Date: 2021/8/21
  Time: 20:43
  To change this template use File | Settings | File Templates.
--%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<%--
    foreach:相当于java的for语句
    1.完成重复操作
    属性
        *begin：开始值
        *end：结束值
        *var：临时变量
        *step：步长
    2.遍历容器
    for(User user:list){

    }
    属性
        *item：容器对象
        *var：容器中元素的临时变量
        varStatus:循环状态对象
        index：容器中元素的索引
        count：循环次数，从1开始

--%>


<c:forEach begin="1" end="10" var="i" step="1">
    ${i}<br>
</c:forEach>

    <%
        List list = new ArrayList();
        list.add("aaa");
        list.add("bbb");
        list.add("ccc");

        request.setAttribute("li",list);
    
    %>

<c:forEach items="${li}" var="str" varStatus="s">
    ${s.index} ${s.count} ${str}
</c:forEach>
</body>
</html>
